﻿namespace UnitFundProfitability.BusinessLogic
{
	using System;
	using System.IO;

	/// <summary>
	/// Class to work with log files.
	/// </summary>
	public static class Log
	{
		#region Constants
		private const string EntryDivider = "--------------------";
		#endregion

		#region Methods
		/// <summary>
		/// Writes the exception.
		/// </summary>
		/// <param name="ex">The exception.</param>
		public static void WriteException(Exception ex)
		{
			using (FileStream fs = new FileStream("log.log", FileMode.Append, FileAccess.Write))
			{
				StreamWriter writer = new StreamWriter(fs);
				writer.WriteLine(ex);
				writer.WriteLine(EntryDivider);
				writer.Flush();
			}
		}
		#endregion
	}
}
